package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_UserAgentRequestOrder 用户代理商申请单
 *
 */
public class TestData_TB_UserAgentRequestOrder
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_UserAgentRequestOrder saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_User user
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_UserAgentRequestOrder");
		return (TB_UserAgentRequestOrder)repository.save(newMust(
				user
			));
	}
	
	public static TB_UserAgentRequestOrder newMust(
		bairui.international.model.domain.jpa.TB_User user
	){
		return new TB_UserAgentRequestOrder(new TB_UserAgentRequestOrder.MustProperties() {
			/** 编号 */
			@Override public String getNumber(){
				return Generator.generate(0, 32);
			}
			/** 状态 */
			@Override public bairui.international.model.status.State_UserAgentRequestOrder getState(){
				return bairui.international.model.status.State_UserAgentRequestOrder.Verifing;
			}
			/** 提交时间 */
			@Override public java.util.Date getSubmitDate(){
				return new java.util.Date();
			}
			/** 用户 */
			@Override public bairui.international.model.domain.jpa.TB_User getUser(){
				return user;
			}
			/** 姓名 */
			@Override public String getName(){
				return Generator.generate(0, 30);
			}
			/** 电话 */
			@Override public String getPhone(){
				return Generator.generate(0, 255);
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_UserAgentRequestOrder saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_User user
	,bairui.international.model.domain.jpa.TB_Admin verifior
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_UserAgentRequestOrder");
		return (TB_UserAgentRequestOrder)repository.save(newAll(
				user
				,verifior
			));
	}
	
	public static TB_UserAgentRequestOrder newAll(
		bairui.international.model.domain.jpa.TB_User user
	,bairui.international.model.domain.jpa.TB_Admin verifior
	){
		return new TB_UserAgentRequestOrder(
			new TB_UserAgentRequestOrder.MustProperties() {
				/** 编号 */
				@Override public String getNumber(){
					return Generator.generate(0, 32);
				}
				/** 状态 */
				@Override public bairui.international.model.status.State_UserAgentRequestOrder getState(){
					return bairui.international.model.status.State_UserAgentRequestOrder.Verifing;
				}
				/** 提交时间 */
				@Override public java.util.Date getSubmitDate(){
					return new java.util.Date();
				}
				/** 用户 */
				@Override public bairui.international.model.domain.jpa.TB_User getUser(){
					return user;
				}
				/** 姓名 */
				@Override public String getName(){
					return Generator.generate(0, 30);
				}
				/** 电话 */
				@Override public String getPhone(){
					return Generator.generate(0, 255);
				}
			},
			new TB_UserAgentRequestOrder.OptionalSingleProperties() {
				/** 审核人员 */
				@Override public bairui.international.model.domain.jpa.TB_Admin getVerifior(){
					return verifior;
				}
				/** 审核时间 */
				@Override public java.util.Date getVerifyDate(){
					return new java.util.Date();
				}
				/** 昵称 */
				@Override public String getNickName(){
					return Generator.generate(0, 255);
				}
				/** 公司 */
				@Override public String getCompany(){
					return Generator.generate(0, 255);
				}
				/** 地址 */
				@Override public String getAddress(){
					return Generator.generate(0, 255);
				}
			}
		);
	}
	

}
